define(function(require, exports, module) {
	"use strict";
	require("../../dep/mui/js/mui.min.js");
	require("../jquery-3.1.1.min.js");
	require("../mui.picker.min.js");
	require("../dateShow.js");
	require("./dateInput.js");
	require("keepDate");
	require('http://g.alicdn.com/ilw/ding/0.8.9/scripts/dingtalk.js');
	//返回清除缓存
	var dingTalkNav = require('dd_config');
	var template = require("template");
	var jurisdictionOrder = require("jurisdictionOrder"); //引入是否超量配置
	var abpUse = require("../abp.js");
	var globalInit = require("globalInit"); //共用js
	var muiTips = require("muiTips");
	mui.init({
		swipeBack: true //启用右滑关闭功能
	});
	var abp = abpUse.abpstart;

	//	var dataModel={};

	var sourceType = 0;
	var sourceSerial = "";
	var sourceId = 0;
	//钉钉右边按钮操作
	dingTalkNav.RightNavBar(false, "新增", "default");
	//接收采购记录详情页传过来的生成采购入库单数据
	if(sessionStorage.getItem('PirchaseID') && sessionStorage.getItem('serialNo') && sessionStorage.getItem('purDetID')) {
		sourceType = Number(abp.sourceType.BUY);
		sourceSerial = sessionStorage.getItem('serialNo');
		sourceId = Number(sessionStorage.getItem('PirchaseID'));
	}

	var getFunList = require("../getFunList/getFunList.js"); //函数配置js
	getFunList.addGoodsInfoList("goodsList", "#goodsListShow"); //新增订单选择货品列表展示	
	//	getFunList.choiceInfo();		//选择信息缓存
	var updateSell = require("./updateSell");
	$(function() {
		//		if($("#Supplier").attr("data-id")&& $("#valorem").attr("data-id")&&$("#staff-user").attr("data-id")){
		//      	$("#sub-btn").show();
		//      }else{
		//      	$("#sub-btn").hide();
		//      }
		var jsonData = JSON.parse(sessionStorage.getItem("sellData"));
		if(jsonData) {
			updateSell.deleteUpdateGoodsDetail({
				"update": ".update-trash", //删除按钮
				"goodsInList": ".goodsIn-list", //移除页面元素
				"data": jsonData,
				"updateArr": jsonData.buyDetail,
				"sellData": "sellData" //需要存储的数组对象
			}, hideList);
			buyDetail();
		}
		//负责人	
		//接收采购记录详情数据 →生成采购入库单
		function session() {
			jsonData.busUserName = $("#staff-user").text();
			jsonData.busUserId = $("#staff-user").attr("data-id");
			sessionStorage.setItem("sellData", JSON.stringify(jsonData));
		}

		function buyDetail() {
			if(sessionStorage.getItem("sellData")) {
				$("#staff-user").text(jsonData.busUserName);
				$("#staff-user").attr("data-id", jsonData.busUserId);

				mui("body").on("tap", "#staff-user", function() {
					session();
				});

				$("#headUL li a").eq(0).addClass('mui-disabled');
				$("#headUL li a").eq(1).addClass('mui-disabled');
				$("#headUL li a span").eq(1).addClass('mui-disabled');
				$("#headUL li a").eq(2).addClass('mui-disabled');
				$("#headUL li a").eq(3).addClass('mui-disabled');
				$("#Supplier").text(jsonData.companyName);
				$("#Supplier").attr("data-id", jsonData.companyId);
				$("#valorem").text(jsonData.taxRateTypeName);
				$("#valorem").attr("data-id", jsonData.taxRateType);
				//			$(".discount").val(jsonData.buyDetail[0].discount);
				$(".remarks").val(jsonData.notes);
				var html = template('goodsInfo', jsonData);
				$("#goodsListShow").prepend(html);
				$("#chioce-product>li").hide();
				$(".choice>li>.setParm").addClass('mui-disabled');
				settlement();

				//		        sessionStorage.setItem('isShow',true);
				//点击货品明细存储值

				mui('body').on('tap', 'header > button', function() {
					clearSession();
					sessionStorage.removeItem('outPirchaseID');
				});

			}
		}
		//编辑采购入库单
		//计算数量与金额 删除明细
		if(sessionStorage.goodsInfoList) {
			//计算总数量与金额
			updateSell.allnumAndAllMoney();
			//删除订单明细
			var goodsLists = JSON.parse(sessionStorage.goodsInfoList);
			updateSell.deleteGoodsDetail({
				"delete": ".delete-trash", //删除按钮
				"array": goodsLists, //需要删除的数组
				"goodsIn": ".goodsIn", //移除页面元素
				"goodsInfoList": "goodsInfoList", //需要存储的数组对象
			}, hideList);
		}
		var outPirchaseID = sessionStorage.getItem("outPirchaseID"); //采购入库ID
		var inPurchaseData = JSON.parse(sessionStorage.getItem("inPurchaseData"));
		var souceId = sessionStorage.getItem("souceId");
		//删除编辑状态下的订单明细
		if(inPurchaseData) {
			updateSell.deleteUpdateGoodsDetail({
				"update": ".update-trash", //删除按钮
				"goodsInList": ".goodsIn-list", //移除页面元素
				"data": inPurchaseData,
				"updateArr": inPurchaseData.buyInputDetail,
				"sellData": "inPurchaseData" //需要存储的数组对象
			}, hideList);
			buyInputDetail();

		} else {
			updateSell.buyInSerialNo();
		}

		function buyInputDetail() {
			$("#sub-btn").show();
			updateSell.updateModel({
				"sellData": inPurchaseData, //后台数据
				"code": "#code", //编号标签ID
				"createDate": ".createDate", //创建时间
				"companyName": "#Supplier", //供应商标签ID
				"busUserName": "#staff-user", //负责人标签ID
				"valorem": "#valorem", //计税方式标签ID
				//				"goodsInfo" : "goodsInfo",				//货品template模板ID
				"goodsListShow": "#goodsListShow", //mainID
				"lastInfo": "#lastInfo", //总金额父盒子
				"allNumber": "#goodsListShow .goodsNum", //总数量
				"allMoney": "#goodsListShow .product-money", //总金额
				"allNum": "#allNum", //总数量赋值
				"allPrice": "#allPrice", //总金额
				"notes": "#notes"
			});
			//渲染后台数据页面
			var dataList = {};
			dataList.buyDetail = inPurchaseData.buyInputDetail;
			var html = template("goodsInfo", dataList);
			$("#goodsListShow").show();
			$("#goodsListShow").prepend(html);

			//点击供应商
			mui("body").on("tap", "#Supplier", function() {
				session();
			});
			//负责人	
			mui("body").on("tap", "#staff-user", function() {
				session();
			});
			//计税方式
			mui("body").on("tap", "#valorem", function() {
				session();
			});
			//点击选择货品
			mui("body").on("tap", "#chioce-product", function() {
				session();
			});
			//点击货品明细存储值
			mui("body").on("tap", "#goodsListShow li", function() {
				session();
			});

			function session() {
				inPurchaseData.serialNo = $("#code").text();
				inPurchaseData.dataCreated = $(".createDate").text();
				inPurchaseData.deliveryDate = $(".lastDate").text();
				inPurchaseData.companyName = $("#Supplier").text();
				inPurchaseData.companyId = $("#Supplier").attr("data-id");
				inPurchaseData.busUserName = $("#staff-user").text();
				inPurchaseData.busUserId = $("#staff-user").attr("data-id");
				inPurchaseData.taxRateType = $("#valorem").attr("data-id");
				inPurchaseData.taxRateTypeName = $("#valorem").text();
				sessionStorage.setItem("inPurchaseData", JSON.stringify(inPurchaseData));
			}

			if(souceId) {
				//不允许修改与添加
				$("#headUL li a").eq(0).addClass('mui-disabled');
				$("#headUL li a").eq(1).addClass('mui-disabled');
				$("#headUL li a span").eq(1).addClass('mui-disabled');
				$("#headUL li a").eq(2).addClass('mui-disabled');
				$("#headUL li a").eq(3).addClass('mui-disabled');
				$(".choice>li").hide();
				$(".choice>li>.setParm").addClass('mui-disabled');
			}
		}
		//计算金额
		updateSell.allnumAndAllMoney();
		//选择客户 税率 以及负责人
		var chioceInfo = require("./chioceInfo.js");
		chioceInfo.chioceMore();

		function buyOrder(statusId) { //请求函数
			var serialNo = $("#code").text().trim();
			var dataCreated = $(".createDate").text().trim(); //创建日期
			//			var deliveryDate=$(".lastDate").text().trim();	  //预交日期
			var notes = $(".remarks").val().trim();
			var companyId = Number($("#Supplier").attr("data-id"));
			var busUserId = Number($("#staff-user").attr("data-id"));
			var taxRateType = $("#valorem").attr("data-id");
			var discount = $(".discount").val() / 100;
			var outBuyInputDetail = [];

			var dataModel = {
				"discount": discount, //(number, optional): 折扣 ,
				"buyInputDetail": outBuyInputDetail, //(Array[BuyInputDetailInput], optional): 采购入库明细参数 ,
				"deliveryDate": "", //(string, optional): 预交日期 ,
				"taxRateType": taxRateType, //(integer): 计税类型 ,
				"currencySerial": "RMB", //(string, optional): 币别 ,
				"currencyName": "人民币", //(string, optional): 币别名称 ,
				"currencyRate": 1, //(number, optional): 汇率 ,
				"serialNo": serialNo, //(string): 单号 ,
				"serialDate": dataCreated, //(string): 单据日期 ,
				"companyId": companyId, //(integer): 客户 ,
				"contactId": 0, //(integer): 联系人 ,
				"busUserId": busUserId, //(integer): 业务员 ,
				"deptId": 0, //(integer): 部门 ,
				"statusId": statusId, //(integer): 提交状态 ,
				"notes": "notes", //(string): 备注 ,
				"id": outPirchaseID, //(integer, optional): Id
			};
			if(!sessionStorage.getItem("sellData")) {
				var productionList = $(".production-list");
				for(var i = 0; i < productionList.length; i++) {
					var whId = Number($(".production-list").eq(i).find(".warehouse").data("id"));
					var goodsId = Number($(".production-list").eq(i).find(".clothes-code").data("id"));
					var goodsUnit = $(".production-list").eq(i).find(".clothes-code").data("unit");
					var price = Number($(".production-list").eq(i).find(".price").text());
					var goodsNum = Number($(".production-list").eq(i).find(".goodsNum").text());
					var taxes = Number($(".production-list").eq(i).data("taxes"));
					var discount = Number($(".production-list").eq(i).data("discount"));
					var notes = $(".production-list").eq(i).data("notes");
					var BuyInputDetailInput = {
						"batchNo": "", //(string, optional): 批号 ,
						"expireTime": "", //(string): 过期时间 ,
						"whId": whId, //(integer, optional): 仓库 ,
						"storageId": 0, //(integer, optional): 储位 ,
						"goodsId": goodsId, //(integer, optional): 货品id ,
						"unit": goodsUnit, //(string): 单位 ,
						"price": price.toFixed(6), //(number): 单价 ,
						"unitCode": goodsUnit, //(string): 副单位 ,
						"unitCodeNumber": goodsNum.toFixed(6), //(number): 副单位数量 ,
						"unitCodeConvertRate": 1, //(number): 副单位转换率 ,
						"unitCode1": "", //(string): 副单位1 ,
						"unitCodeConvertRate1": 0, //(number): 副单位1转换率 ,
						"unitCode2": "", //(string): 副单位2 ,
						"unitCodeConvertRate2": 0, //(number): 副单位2转换率 ,
						"unitCodeAssist": "", //(string): 辅单位 ,
						"unitCodeNumberAssist": 0, //(number): 辅单位数量 ,
						"discount": discount, //(number): 折扣 ,
						"isGift": false, //(boolean): 是否赠品 ,
						"taxRate": taxes, //(number): 税率 ,
						"sourceType": 0,
						"sourceSerial": "",
						"sourceId": 0,
						"sourceItemId": 0,
						"notes": notes, //(string): 备注 ,
						"id": 0, //(integer, optional): Id
					};
					//					dataModel.buyInputDetail.push(BuyInputDetailInput);
					outBuyInputDetail.push(BuyInputDetailInput);
				}
			} else {
				var goodsLists = jsonData.buyDetail;
				for(var i = 0; i < goodsLists.length; i++) {
					var BuyInputDetailInput = {
						"batchNo": "", //(string, optional): 批号 ,
						"expireTime": "", //(string): 过期时间 ,
						"whId": goodsLists[i].whId, //(integer, optional): 仓库 ,
						"storageId": 0, //(integer, optional): 储位 ,
						"goodsId": goodsLists[i].goodsId, //(integer, optional): 货品id ,
						"unit": goodsLists[i].unit, //(string): 单位 ,
						"price": goodsLists[i].price, //(number): 单价 ,
						"unitCode": goodsLists[i].unitCode, //(string): 副单位 ,
						"unitCodeNumber": goodsLists[i].unitCodeNumber, //(number): 副单位数量 ,
						"unitCodeConvertRate": 1, //(number): 副单位转换率 ,
						"unitCode1": "", //(string): 副单位1 ,
						"unitCodeConvertRate1": 0, //(number): 副单位1转换率 ,
						"unitCode2": "", //(string): 副单位2 ,
						"unitCodeConvertRate2": 0, //(number): 副单位2转换率 ,
						"unitCodeAssist": "", //(string): 辅单位 ,
						"unitCodeNumberAssist": 0, //(number): 辅单位数量 ,
						"discount": Number(goodsLists[i].discount), //(number): 折扣 ,
						"isGift": false, //(boolean): 是否赠品 ,
						"taxRate": Number(goodsLists[i].taxRate), //(number): 税率 ,
						"sourceType": sourceType, //(integer): 来源类型 ,
						"sourceSerial": sourceSerial, //(string, optional): 来源单号 ,
						"sourceId": sourceId, //(integer): 来源id ,
						"sourceItemId": Number(goodsLists[i].id), //(integer): 来源明细id ,
						"notes": goodsLists[i].notes, //(string): 备注 ,
						"id": 0, //(integer, optional): Id
					};
					outBuyInputDetail.push(BuyInputDetailInput);
				}
			}
			if(souceId) {
				for(var i = 0; i < inPurchaseData.buyInputDetail.length; i++) {
					dataModel.buyInputDetail[i].sourceType = inPurchaseData.buyInputDetail[i].sourceType || 0; //(integer): 来源类型 
					dataModel.buyInputDetail[i].sourceSerial = inPurchaseData.buyInputDetail[i].sourceSerial || ""; //(string, optional): 来源单号 ,
					dataModel.buyInputDetail[i].sourceId = inPurchaseData.buyInputDetail[i].sourceId || 0; //(integer): 来源id ,
					dataModel.buyInputDetail[i].sourceItemId = inPurchaseData.buyInputDetail[i].sourceItemId || 0; //(integer): 来源明细id ,
				}
			}
			return dataModel;
		}


		var option = {};

		//新增
		function create(dataModel) {
			if(dataModel.statusId == abp.statusId.Finish) {
				globalInit.buttonInit(".mui-btn-sub");
			}
			abp.services.app.buyInputList.create(dataModel, option)
				.done(function(data) {
					//调转到详情页
					function locaHref() {
						document.location.href = "../outPurchase/index.html?dd_nav_bgcolor=FFFF943E";
					}
					if(dataModel.statusId == abp.statusId.Draft) {
						muiTips.alertTips(' ', "保存成功", 1, 3, locaHref);
						globalInit.buttonReset(".keep-draft");
					} else {
						muiTips.alertTips(' ', "提交成功", 1, 3, locaHref);
						globalInit.buttonReset(".mui-btn-sub");
					}

					sessionStorage.removeItem('PirchaseID');
					sessionStorage.removeItem('purchaseStastusId');
					clearSession();
					if(data.success) {

					} else {}

				})
				.fail(function(data) {
					muiTips.alertTips(' ', data.message, 3, 3, "default");
					//globalInit.buttonReset(".btnDisabledText");
					if(dataModel.statusId == abp.statusId.Draft) {
						globalInit.buttonReset(".keep-draft");
					} else {
						globalInit.buttonReset(".mui-btn-sub");
					}
				});
		}

		//編輯
		function update(dataModel) {
			if(dataModel.statusId == abp.statusId.Finish) {
				globalInit.buttonInit(".mui-btn-sub");
			}
			abp.services.app.buyInputList.update(dataModel, option)
				.done(function(data) {
					function locaUpdateHref() {
						document.location.href = "../../src/purchase/purchaseDetail.html?dd_nav_bgcolor=FFFF943E";
					}
					if(dataModel.statusId == abp.statusId.Draft) {
						muiTips.alertTips(' ', "修改成功", 1, 3, locaUpdateHref);
						globalInit.buttonReset(".keep-draft");
					} else {
						muiTips.alertTips(' ', "提交成功", 1, 3, locaUpdateHref);
						globalInit.buttonReset(".mui-btn-sub");
					}
					sessionStorage.removeItem('PirchaseID');
					sessionStorage.removeItem('purchaseStastusId');
					clearSession();
				})
				.fail(function(data) {
					muiTips.alertTips(' ', data.message, 3, 3, "default");
					//					globalInit.buttonReset(".btnDisabledText");
					if(dataModel.statusId == abp.statusId.Draft) {
						globalInit.buttonReset(".keep-draft");
					} else {
						globalInit.buttonReset(".mui-btn-sub");
					}
				});
		}
		//隐藏按钮与总金额
		hideList();

		function hideList() {
			if($("#goodsListShow .product-money").length > 0) {
				$("#lastInfo").show();
				$("#goodsListShow").show();
			} else {
				$("#lastInfo").hide();
				$("#goodsListShow").hide();

			}
			if(($("#goodsListShow .product-money").length > 0) && ($("#Supplier").attr("data-id") || $("#companyName").attr("data-id")) && $("#valorem").attr("data-id") && $("#staff-user").attr("data-id")) {
				$("#sub-btn").show();

			} else {
				$("#sub-btn").hide();
			}

		}

		//提交审核
		mui("body").on("tap", ".mui-btn-sub", function() {
			globalInit.buttonInit(".mui-btn-sub");
			var dataModel = buyOrder(abp.statusId.Finish);
			if(!dataModel.id || dataModel.id === undefined) {
				jurisdictionOrder.getJurisdiction(abp.sourceType.BUY, create, dataModel);
				//create(dataModel);
				return false;
			} else {
				jurisdictionOrder.getJurisdiction(abp.sourceType.BUY, update, dataModel);
				//				update(dataModel);
				return false;
			}
		});

		//保存草稿
		mui("body").on("tap", ".keep-draft", function() {
			globalInit.buttonInit(".keep-draft");
			var dataModel = buyOrder(abp.statusId.Draft);
			if(!dataModel.id || dataModel.id === undefined) {
				create(dataModel);
				return false;
			} else {
				update(dataModel);
				return false;
			}

		});

		//设置计税参数配置
		mui("body").on("tap", ".setParm", function() {
			sessionStorage.setParm = $("#valorem").attr("data-id");
		});
		mui("body").on("tap", "#goodsListShow .goodsIn-list", function() {
			sessionStorage.setParm = $("#valorem").attr("data-id");
		});
		//计算总金额总数量
		function settlement() {
			//总数量 总金额
			var allnumber, totalAmount;
			var arrays = [];
			var lastMoney = [];
			//遍历所有货品的数量
			$.each($("#goodsListShow .goodsNum"), function(i, v) {
				allnumber = Number($(v).text());
				arrays.push(allnumber);
			});
			//总数量
			//			console.log(lastMoney)
			for(var i = 0; i < arrays.length - 1; i++) {
				allnumber += arrays[i];
			}
			//		console.log(allnumber)
			$("#allNum").text(allnumber);
			//遍历所有货品的单金呢
			$.each($("#goodsListShow .product-money"), function(i, v) {
				totalAmount = Number($(v).attr("data-amount"));
				lastMoney.push(totalAmount);
			});
			//总金额
			for(var i = 0; i < lastMoney.length - 1; i++) {
				totalAmount += lastMoney[i];
			}
			$("#allPrice").text(Number(totalAmount).toFixed(2));

		}

		function countFun() {
			var allPrice = Number($("#allPrice").text()); //产品总价
			var discount = ($(".discount").val() / 100); //折扣率
			var discountMoney = allPrice * (1 - discount);
			$("#discountMoney").val(discountMoney.toFixed(2));
			$("#cutAfterMoney").text((allPrice - discountMoney).toFixed(2));
		}

		$("body").on("keyup", ".discount", function() {
			countFun();
		});
		$("body").on("keyup", "#discountMoney", function() {
			var discountMoney = $("#discountMoney").val(); //折扣额
			var allPrice = Number($("#allPrice").text()); //产品总价
			var discount = (allPrice - discountMoney) / allPrice * 100;
			$(".discount").val(Math.round(discount.toFixed(2)));
		});

	});

	//采购记录生成时返回
	if(sessionStorage.getItem("sellData")) {
		//钉钉返回清除缓存
		//ios
		dingTalkNav.LeftNavBar(clearSessionDD);
		//ad
		dingTalkNav.leftAndroid(clearSessionDD);
		//create
		dingTalkNav.setTitleText("生成采购入库");
	} else if(sessionStorage.getItem("inPurchaseData")) {
		//钉钉返回清除缓存
		//ios
		dingTalkNav.LeftNavBar(clearSessionDDBuyIn);
		//ad
		dingTalkNav.leftAndroid(clearSessionDD);
		//update
		dingTalkNav.setTitleText("编辑采购入库");
	} else if(sessionStorage.getItem("createHome")) {
		//钉钉返回清除缓存
		//ios
		dingTalkNav.LeftNavBar(clearSessionDDHome);
		//ad
		dingTalkNav.leftAndroid(clearSessionDDHome);
		//create
		dingTalkNav.setTitleText("新增采购入库");
	} else {
		//ios
		//create
		dingTalkNav.setTitleText("新增采购入库");
		dingTalkNav.LeftNavBar(clearSessionDDCreate);
		//ad
		dingTalkNav.leftAndroid(clearSessionDDCreate);
	}
	//清除缓存
	function clearSession() {
		sessionStorage.removeItem('serialNo');
		sessionStorage.removeItem('sellData');
		sessionStorage.removeItem('inPurchaseData');
		sessionStorage.removeItem('purDetID');
		sessionStorage.removeItem("chioceStaff");
		sessionStorage.removeItem("chioceStaffId");
		sessionStorage.removeItem("statusType");
		sessionStorage.removeItem('goodsInfoList');
		sessionStorage.removeItem('goodsUnit');
		sessionStorage.removeItem("setParm");
		//		sessionStorage.removeItem("strStatusId");
		sessionStorage.removeItem("supplierId");
		sessionStorage.removeItem("valoremName");
		sessionStorage.removeItem("valoremNameId");
		sessionStorage.removeItem("chioceSupplierName");
		sessionStorage.removeItem("chioceSupplierNameId");
		sessionStorage.removeItem("deliveryDate");
		sessionStorage.removeItem('flags');
		sessionStorage.removeItem("souceId");
		sessionStorage.removeItem('createHome');
	}

	function clearSessionDD() {
		clearSession();
		document.location.href = "../../src/purchase/purchaseDetail.html?dd_nav_bgcolor=FFFF943E";
	}

	function clearSessionDDBuyIn() {
		clearSession();
		document.location.href = "../../src/outPurchase/outPurchase.html?dd_nav_bgcolor=FFFF943E";
	}

	function clearSessionDDCreate() {
		clearSession();
		document.location.href = "../../src/outPurchase/index.html?dd_nav_bgcolor=FFFF943E";
	}
	//钉钉
	function clearSessionDDHome() {
		clearSession();
		document.location.href = "../../src/index.html?dd_nav_bgcolor=FFFF943E";
	}

	//添加标识
	mui("body").on("tap", "#goodsListShow .goodsIn-list", function() {
		sessionStorage.setParm = $("#valorem").attr("data-id");
		sessionStorage.setItem("goodsIndex", $(this).attr("data-id"));
		sessionStorage.setItem("statusType", $(this).attr("data-status"));
		sessionStorage.removeItem("goodsId");
		sessionStorage.removeItem("localstatusType");
		sessionStorage.removeItem("chioce");
	});
	//设置计税参数配置
	mui("body").on("tap", ".product-goods", function() {
		sessionStorage.setParm = $("#valorem").attr("data-id");
		sessionStorage.removeItem("localstatusType");
		sessionStorage.removeItem("statusType");
	});
	mui("body").on("tap", "#goodsListShow .goodsIn", function() {
		sessionStorage.setParm = $("#valorem").attr("data-id");
		sessionStorage.setItem("goodsIndex", $(this).attr("data-id"));
		sessionStorage.setItem("localstatusType", $(this).attr("data-other"));
		sessionStorage.removeItem("goodsId");
		sessionStorage.removeItem("statusType");
		sessionStorage.removeItem("chioce");
	});
	mui("body").on("tap", "#goodsListShow .goodsIn-list", function() {
		sessionStorage.setParm = $("#valorem").attr("data-id");
		sessionStorage.setItem("goodsIndex", $(this).attr("data-id"));
		sessionStorage.setItem("statusType", $(this).attr("data-status"));
		sessionStorage.removeItem("goodsId");
		sessionStorage.removeItem("localstatusType");
		sessionStorage.removeItem("chioce");
	});

	//判断是否启用审批
	var eHistory = require("eHistory");
	var isExamina = eHistory.funIsAuditSetting(abp.sourceType.BUY_INPUT, sourceId);
	if(isExamina === true) {
		$("#btnSubmitExamina").text("提交审核");
	} else {
		$("#btnSubmitExamina").text("提交");
	}

});